import request from '@/utils/request'

// 查询店铺活动列表
export function listDiscount(query) {
  return request({
    url: '/market/discount/list',
    method: 'get',
    params: query
  })
}

//查询活动商品
export function getGoodsList(query) {
  return request({
    url: '/market/discount/getGoodsList/',
    method: 'get',
    params: query
  })
}

//查询活动赠品
export function getGiftList(query) {
  return request({
    url: '/market/discount/getGiftList/',
    method: 'get',
    params: query
  })
}

// 查询店铺活动详细
export function getDiscount(id) {
  return request({
    url: '/market/discount/' + id,
    method: 'get'
  })
}

// 新增店铺活动
export function addDiscount(data) {
  return request({
    url: '/market/discount',
    method: 'post',
    data: data
  })
}

// 修改店铺活动
export function updateDiscount(data) {
  return request({
    url: '/market/discount',
    method: 'put',
    data: data
  })
}

// 删除店铺活动
export function delDiscount(id) {
  return request({
    url: '/market/discount/' + id,
    method: 'delete'
  })
}

// 状态修改
export function changeDiscountStatus(id, status) {
  const data = {
    id,
    status
  }
  return request({
    url: '/market/discount/changeStatus',
    method: 'put',
    data: data
  })
}

// 新增店铺活动商品
export function addGoods(data) {
  return request({
    url: '/market/discount/addGoods',
    method: 'post',
    data: data
  })
}


// 删除活动商品
export function delDiscountGoods(id) {
  return request({
    url: '/market/discount/delDiscountGoods/' + id,
    method: 'delete'
  })
}

// 新增店铺活动赠品
export function addGift(data) {
  return request({
    url: '/market/discount/addGift',
    method: 'post',
    data: data
  })
}

// 删除活动赠品
export function delDiscountGift(id) {
  return request({
    url: '/market/discount/delDiscountGift/' + id,
    method: 'delete'
  })
}
